#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long i,j,a,b,sum=0;
	cin>>a>>b;
	if(a>b) swap(a,b);
	for(i=a;i<=b;i++)
	{
		if(i<=1) continue;
		int k=sqrt(i);
		for(j=2;j<=k;j++)
		if(i%j==0) break;
		if(j>k) sum+=i;
	}
	cout<<sum;
    return 0;
}
